home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue44 / clinic / TreeVuU.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1999-02-02  |  1.3 KB  |  65 lines

  1. unit TreeVuU;
  2.  
  3. {$ifdef Windows} { Delphi 1.0x }
  4.   'Win32 only'
  5. {$endif}
  6. {$ifdef Ver90} { Delphi 2.0x }
  7.   {$define DelphiLessThan4}
  8. {$endif}
  9. {$ifdef Ver93} { C++ Builder 1.0x }
  10.   {$define DelphiLessThan4}
  11. {$endif}
  12. {$ifdef Ver100} { Delphi 3.0x }
  13.   {$define DelphiLessThan4}
  14. {$endif}
  15. {$ifdef Ver110} { C++ Builder 3.0x }
  16.   {$define DelphiLessThan4}
  17. {$endif}
  18. interface
  19.  
  20. uses
  21.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  22.   StdCtrls, ComCtrls;
  23.  
  24. type
  25.   TForm1 = class(TForm)
  26.     TreeView1: TTreeView;
  27.     CheckBox1: TCheckBox;
  28.     procedure CheckBox1Click(Sender: TObject);
  29.   private
  30.     { Private declarations }
  31.   public
  32.     { Public declarations }
  33.   end;
  34.  
  35. var
  36.   Form1: TForm1;
  37.  
  38. implementation
  39.  
  40. {$R *.DFM}
  41.  
  42. procedure TForm1.CheckBox1Click(Sender: TObject);
  43. {$ifdef DelphiLessThan4}
  44. const
  45.   TVS_NOTOOLTIPS = $80;
  46. var
  47.   Style: Integer;
  48. begin
  49.   Style := GetWindowLong(TreeView1.Handle, GWL_STYLE);
  50.   //Could use this if you just wanted to toggle states
  51.   //Style := Style xor TVS_NOTOOLTIPS;
  52.   if CheckBox1.Checked then
  53.     Style := Style and not TVS_NOTOOLTIPS
  54.   else
  55.     Style := Style or TVS_NOTOOLTIPS;
  56.   SetWindowLong(TreeView1.Handle, GWL_STYLE, Style);
  57. end;
  58. {$else}
  59. begin
  60.   TreeView1.Tooltips := CheckBox1.Checked
  61. end;
  62. {$endif}
  63.  
  64. end.
  65.